package main;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.NoSuchElementException;

import org.biojava.bio.BioException;

import utils.Permutator;
import utils.SequenceDatabase;
import utils.SequenceDriver;

public class StatisticsMain {

	

	public static void main(String[] args) throws NoSuchElementException,
			BioException, IOException {
		SequenceDatabase db = new SequenceDatabase("sequences/LSURef93_lbl.fasta");
		
		System.out.println("Number of LSU organisms: "
				+ db.size());
		double counter=0;
		int As=0;
		int Gs=0;
		int Us=0;
		int Cs=0;
		
		for (int i=0;i<db.size();i++){
			String sequence = db.getSequence(i);
			counter=counter+sequence.length();	
			char[] arr=sequence.toCharArray();
			for (int j=0;j<arr.length;j++){
				if (arr[j]=='a') As++;
				if (arr[j]=='g') Gs++;
				if (arr[j]=='c') Cs++;
				if (arr[j]=='u') Us++;
			}
		}
		double sum=As+Gs+Cs+Us;
		System.out.println("Average sequence length="+counter/db.size());
		System.out.println("As="+As/sum+"\nGs="+Gs/sum+"\nUs="+Us/sum+"\nCs="+Cs/sum);
		System.out.println("Total is:"+(As/sum+Gs/sum+Us/sum+Cs/sum));
		System.out.println("Program finished");
	}
}
